﻿package core.ui.controls
{
    import core.enum.*;
    import flash.display.*;
    import flash.events.*;

    public class BrushTypeButton extends Sprite
    {
        var bg:Sprite;
        var icon:Bitmap;
        public var type:BrushType;
        private var marked:Boolean = false;

        public function BrushTypeButton(param1:BrushType, param2:BitmapData, param3:int, param4:int)
        {
            this.type = param1;
            this.bg = new Sprite();
            this.bg.graphics.beginFill(7961731);
            this.bg.graphics.drawRect(0, 0, 24, 24);
            this.bg.graphics.beginFill(14606822);
            this.bg.graphics.drawRect(1, 1, 22, 22);
            this.bg.graphics.endFill();
            this.bg.alpha = 0;
            addChild(this.bg);
            this.icon = new Bitmap(param2);
            this.icon.alpha = 0.7;
            this.icon.x = param3;
            this.icon.y = param4;
            addChild(this.icon);
            this.addEventListener(MouseEvent.MOUSE_OVER, this.MouseOver);
            this.addEventListener(MouseEvent.MOUSE_OUT, this.MouseOut);
            return;
        }// end function

        private function MouseOver(event:MouseEvent) : void
        {
            this.bg.alpha = 1;
            this.icon.alpha = 1;
            return;
        }// end function

        private function MouseOut(event:MouseEvent) : void
        {
            if (!this.marked)
            {
                this.bg.alpha = 0;
                this.icon.alpha = 0.7;
            }
            return;
        }// end function

        public function Mark(param1:Boolean)
        {
            this.marked = param1;
            if (param1)
            {
                this.MouseOver(null);
            }
            else
            {
                this.MouseOut(null);
            }
            return;
        }// end function

    }
}
